import cv2 as cv

filename = r"C:\opencv\opencv-3.4.1\samples\data\lena.jpg"
img = cv.imread(filename)
B=img.copy()
B[:,:,1]=0
B[:,:,2]=0
G=img.copy()
G[:,:,0]=0
G[:,:,2]=0
R=img.copy()
R[:,:,1]=0
R[:,:,0]=0

hsv = cv.cvtColor(img,cv.COLOR_BGR2HSV)

#显示图片
cv.imshow('hello world',img)

cv.imshow('B',B)
cv.imshow('G',G)
cv.imshow('R',R)
cv.imshow('Hue',hsv[:,:,0])
cv.imshow('Saturation',hsv[:,:,1])
cv.imshow('Value',hsv[:,:,2])

cv.waitKey()
cv.destroyAllWindows()
